<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<link rel="stylesheet" type="text/css" href="/static/component/laytp/module/cityPicker/city-picker.css">
<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title"><div class="page-title-con"><span id="flowsetname"></span><div class="move_title"></div><?php include "../public/subturn.php";?></div></div>
    <div class="main-container">
        <div class="block-generic">
            <?php include "../public/substt.php";?>
            <div class="block-generic">
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="edittits"><span>原合同信息</span></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md6">
                            <label class="layui-form-label">持证人</label>
                            <div class="layui-input-block">
                                <input type="text" id="person_name" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <label class="layui-form-label">人员性质</label>
                            <div class="layui-input-block">
                                <input type="text" id="person_nature" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md6">
                            <label class="layui-form-label">合同编号</label>
                            <div class="layui-input-block">
                                <input type="text" id="yuan_number" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <label class="layui-form-label">签约日期</label>
                            <div class="layui-input-block">
                                <input type="text" id="yuan_sign_dt" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md6">
                            <label class="layui-form-label">聘期开始时间</label>
                            <div class="layui-input-block">
                                <input type="text" id="yuan_start_dt" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <label class="layui-form-label">聘期结束时间</label>
                            <div class="layui-input-block">
                                <input type="text" id="yuan_end_dt" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md6">
                            <label class="layui-form-label">聘用资格</label>
                            <div class="layui-input-block">
                                <input type="text" id="yuan_qualification" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <label class="layui-form-label">聘用渠道</label>
                            <div class="layui-input-block">
                                <input type="text" id="yuan_channel" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md6">
                            <label class="layui-form-label">聘费支付方式</label>
                            <div class="layui-input-block">
                                <input type="text" id="yuan_pay_type" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <label class="layui-form-label">聘费</label>
                            <div class="layui-input-block">
                                <input type="text" id="yuan_money" readonly placeholder="请输入" autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                    </div>
                </div>




                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="edittits"><span>补充合同信息</span></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md12">
                            <label class="layui-form-label"><text>*</text>补充合同名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="name" id="name" placeholder="请输入" clearable autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md6">
                            <label class="layui-form-label">补充合同编号</label>
                            <div class="layui-input-block">
                                <input type="text" id="number" placeholder="审核完成后自动生成" readonly autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <label class="layui-form-label">签订日期</label>
                            <div class="layui-input-block">
                                <input type="text" name="sign_dt" id="sign_dt" placeholder="请选择" clearable autocomplete="off" class="layui-input bdate_ymd">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item height_auto">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md12">
                            <label class="layui-form-label label_textarea">聘用说明</label>
                            <div class="layui-input-block">
                                <textarea id="yongshuo" name="yongshuo" placeholder="请输入" class="layui-textarea"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md6">
                            <label class="layui-form-label" id="money_label"><text>*</text>补充聘费(元)</label>
                            <div class="layui-input-block">
                                <input type="text" placeholder="请输入" name="money" id="money" clearable autocomplete="off" class="layui-input moneyinput">
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <label class="layui-form-label">聘费支付方式</label>
                            <div class="layui-input-block">
                                <input type="text" id="pay_type_name" name="pay_type_name" readonly placeholder="请输入" clearable autocomplete="off" class="layui-input disabled">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item height_auto">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md12">
                            <label class="layui-form-label label_textarea">聘费说明</label>
                            <div class="layui-input-block">
                                <textarea id="feishuo" name="feishuo" placeholder="请输入" class="layui-textarea"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md6">
                            <label class="layui-form-label"><text>*</text>聘期开始时间</label>
                            <div class="layui-input-block">
                                <input type="text" name="startdt" id="startdt" placeholder="请输入" clearable autocomplete="off" class="layui-input bdate_ymd">
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <label class="layui-form-label"><text>*</text>聘期结束时间</label>
                            <div class="layui-input-block">
                                <input type="text" name="enddt" id="enddt" placeholder="请输入" clearable autocomplete="off" class="layui-input bdate_ymd">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item height_auto">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md12">
                            <label class="layui-form-label label_textarea">备注</label>
                            <div class="layui-input-block">
                                <textarea id="explain" name="explain" placeholder="请输入" class="layui-textarea"></textarea>
                            </div>
                        </div>
                    </div>
                </div>

                <?php include '../public/flowqita.php'?>
                <?php include '../public/upinfo.php'?>
            </div>
        </div>
    </div>
</form>
<script>
    var param_id = getQueryVariable('id') || 0;
    chu_flow_edit_yushen();

    $("#commentForm").validate({
        rules: {
            name: {required: true},
            money: {required: true},
            startdt: {required: true},
            enddt: {required: true},
        },
        messages:{
            name: {required: "请输入"},
            money: {required: "请输入"},
            startdt: {required: "请选择"},
            enddt: {required: "请选择"},
        }
    });


    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();
        facade.ajax({type: 'get', url: ask_flowdata_edit_cert_empbu, data:{id:param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                chu_flow_qian(data);

                var midinfo = res.data.midinfo;
                $("#person_name").val(midinfo.person_name);
                $("#person_nature").val(midinfo.nature);
                $("#yuan_number").val(midinfo.number);
                $("#yuan_sign_dt").val(midinfo.sign_dt);
                $("#yuan_start_dt").val(midinfo.start_dt);
                $("#yuan_end_dt").val(midinfo.end_dt);
                $("#yuan_qualification").val(midinfo.qualification);
                $("#yuan_channel").val(midinfo.channel);
                $("#yuan_pay_type").val(midinfo.pay_type_name);
                $("#yuan_money").val(midinfo.money);


                $('#number').val(data.number);
                $('#sign_dt').val(data.sign_dt);
                $('#yongshuo').val(data.yongshuo);
                $('#money').val(data.money);
                $('#pay_type_name').val(data.pay_type_name);
                $('#feishuo').val(data.feishuo);
                $('#startdt').val(data.startdt);
                $('#enddt').val(data.enddt);
                $('#explain').val(data.explain);


                initParseMoney();
                public_upload_file_load('upload_files', res.data.files);
                render_from();
            }
        });


        form.on('submit(add)', function(data){
            data.field.isturn = $(this).attr('key') || 0;
            data.field.isshen = $(this).attr('isshen') || 0;
            data.field.flowrelas = get_choose_val('flowrelas');
            data.field.advaners = tan_tags_getvalue("#advaners", 'user');
            data.field.nexter = tan_tags_getvalue("#nexter", 'user');
            parseMoney(data);


            if(data.field.isturn > 0){
                var validRes = $("#commentForm").valid();

                if(!validRes){return false;}
            }

            data.field.id = param_id;
            data.field.files = public_upload_file_value('upload_files');
            data = parseMoney(data);
            public_flow_submit(data.field, ask_flowdata_add_cert_empbu, ask_flowdata_edit_cert_empbu, $(this).attr('but'));

            return false;
        });

    });



</script>
</body>
</html>
